Skip to content

Add CsSig analyzer for .cssig signature files - #31

Merged
agocke merged 4 commits into
mainfrom
cssig
Jun 28, 2026
Merged

Add CsSig analyzer for .cssig signature files#31
agocke merged 4 commits into
mainfrom
cssig

Conversation

@agocke

@agocke agocke commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Introduces a .cssig file format and Roslyn analyzer for C#, analogous to the public API analyzer. A .cssig file contains body-less C# member declarations, and the analyzer verifies that a project's public API surface matches them under source and/or binary equivalence.

What's included

  • Analyzer (StaticCs.CsSig.Analyzers): parses .cssig files and diagnoses mismatches between the declared signatures and the project's public API (missing members, signature differences, source-only differences such as nullability).
  • Code fix (StaticCs.CsSig.CodeFixes): generates .cssig content — regenerate an existing type's file, populate PublicAPI.cssig, or emit one file per type, including a FixAll.
  • NuGet package StaticCS.CsSig: ships both analyzer assemblies under analyzers/dotnet/cs plus a props file that auto-includes **/*.cssig as AdditionalFiles and exposes the CsSigEquivalence option (Source/Binary/Both).
  • VS Code extension: TextMate grammar + language configuration for .cssig syntax highlighting.
  • Source model captures nullability as a source-only concept (no binary impact), enforced only under Source/Both equivalence.
  • IndentingBuilder is consumed as a source-only package and compiled directly into the analyzer assembly, so the package is self-contained.

Naming

Project files, assembly names, and packed .dll names use the StaticCs.CsSig.Analyzers / StaticCs.CsSig.CodeFixes convention, matching the rest of the StaticCs.* repo.

Validation

  • dotnet build static-cs.sln — clean.
  • dotnet test static-cs.sln — 91 passed, 1 skipped.
  • dotnet pack produces StaticCS.CsSig.0.1.0.nupkg shipping StaticCs.CsSig.Analyzers.dll, StaticCs.CsSig.CodeFixes.dll, and build/StaticCS.CsSig.props; verified end-to-end against a consumer project.

agocke and others added 4 commits June 28, 2026 04:23
CsSig is a mechanism for tracking the public API of a project
through 'signature files' -- .cssig files that only contain
C# signature definitions.
Rename the analyzer and code-fix project files (and their assembly
names, and the packed analyzer .dll names) from CsSig.Analyzers/
CsSig.CodeFixes to StaticCs.CsSig.Analyzers/StaticCs.CsSig.CodeFixes
for consistency with the StaticCs.* naming convention. Update the
solution, test project references, and the packaging dll names to match.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The .cssig VS Code extension is first-party source for the CsSig
feature, so co-locate it with the analyzer under src/CsSig rather
than a top-level editors/ directory. Update the README link.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CancelScope.cs was inadvertently grouped into the CsSig work; it is
unrelated to the analyzer and referenced nowhere, so drop it from this
branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@agocke
agocke merged commit 537cb5b into main Jun 28, 2026
1 check passed
@agocke
agocke deleted the cssig branch June 28, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant